import Viewer from 'viewerjs';
import { useEffect, useRef } from 'react'
// 图片查看器
const ImageViewer: React.FC = ({ children }) => {
    // console.log(858585, children);
    const containerEle =useRef(null)
    useEffect(() => {
        const viewer = new Viewer(containerEle.current as never as HTMLElement,);

        return ()=>{
            //表示组件将要销毁的时候执行，等价于commentWillUnMount
            viewer.destroy()
        }
    }, [children])
    return (
        <div ref={containerEle} >{children}</div>
    )
}

export default ImageViewer